package ve.ucv.patologiaocular.domain;

import java.sql.Blob;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

@Entity
@Table(name = "FOTO")
public class Foto {
	private Integer id;
	private String tipoFoto;
	private byte[] imagen;
	private Muestra MuestraId = new Muestra();

	@Id
	@GeneratedValue
	@Column(name = "ID")
	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@Column(name = "TIPOFOTO")
	public String getTipoFoto() {
		return tipoFoto;
	}

	public void setTipoFoto(String tipoFoto) {
		this.tipoFoto = tipoFoto;
	}

	@Lob
	@Column(name = "IMAGEN", columnDefinition="longblob")	
	//@Basic(fetch = FetchType.EAGER)
	public byte[]  getImagen() {
		return imagen;
	}

	public void setImagen(byte[]  imagen) {
		this.imagen = imagen;
	}
	
	//@Column(name = "MUESTRA_ID")
	@ManyToOne(optional = false)    
	@JoinColumn(name = "MUESTRA_ID")
	public Muestra getMuestraId() {
		return MuestraId;
	}
	
	public void setMuestraId(Muestra MuestraId) {
		this.MuestraId = MuestraId;
	}
}

